#ifndef DRAWWIDGET_H
#define DRAWWIDGET_H

#include <QWidget>
#include <QPainter>
#include <QList>
#include <QPolygon>

struct Point {
    double x;
    double y;
    Point(double _x, double _y) : x(_x), y(_y) {}

};

class DrawWidget : public QWidget
{
    Q_OBJECT
public:
    DrawWidget(QWidget *parent = nullptr);
    void startDraw(int count);
    void saveImage();
//    void saveImageToSvg();

public:
    bool isDrawing;
    double chipWidth;   //芯片宽度
    double chipHeight;  //芯片高度
    double hSpace;      //水平间距
    double vSpace;      //垂直间距
    double waferDim;    //晶圆直径
    double edgeSpace;   //边界距离
    double flatHeight;  //平边高度
    int chipCount;
    double imageLenght;

    QList<Point> pointList;    //芯片位置数组
protected:
    void paintEvent(QPaintEvent *event) override;
    void drawChip(QPainter &painter, float scale);
    void drawOutline(QPainter &painter, float scale);
    void drawText(QPainter &painter, int scale);

private:
    QPainter mPainter; // 声明一个QPainter成员变量
    int drawCenterX, drawCenterY;
    int startPointX, startPointY;
};

#endif // DRAWWIDGET_H
